3.201 \(\int \cot (e+f x) (a+b \tan ^2(e+f x))^2 \, dx\)

Optimal. Leaf size=51 \[ \frac{a^2 \log (\tan (e+f x))}{f}+\frac{(a-b)^2 \log (\cos (e+f x))}{f}+\frac{b^2 \tan ^2(e+f x)}{2 f} \]

[Out]

((a - b)^2*Log[Cos[e + f*x]])/f + (a^2*Log[Tan[e + f*x]])/f + (b^2*Tan[e + f*x]^2)/(2*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0635241, antiderivative size = 51, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {3670, 446, 72} \[ \frac{a^2 \log (\tan (e+f x))}{f}+\frac{(a-b)^2 \log (\cos (e+f x))}{f}+\frac{b^2 \tan ^2(e+f x)}{2 f} \]

Antiderivative was successfully verified.

[In]

Int[Cot[e + f*x]*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

((a - b)^2*Log[Cos[e + f*x]])/f + (a^2*Log[Tan[e + f*x]])/f + (b^2*Tan[e + f*x]^2)/(2*f)

Rule 3670

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff)/f, Subst[Int[(((d*ff*x)/c)^m*(a + b*(ff*x)^n)^p)/(c^
2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rule 446

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 72

Int[((e_.) + (f_.)*(x_))^(p_.)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Int[ExpandIntegrand[(
e + f*x)^p/((a + b*x)*(c + d*x)), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && IntegerQ[p]

Rubi steps

\begin{align*} \int \cot (e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac{\operatorname{Subst}\left (\int \frac{\left (a+b x^2\right )^2}{x \left (1+x^2\right )} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{\operatorname{Subst}\left (\int \frac{(a+b x)^2}{x (1+x)} \, dx,x,\tan ^2(e+f x)\right )}{2 f}\\ &=\frac{\operatorname{Subst}\left (\int \left (b^2+\frac{a^2}{x}-\frac{(a-b)^2}{1+x}\right ) \, dx,x,\tan ^2(e+f x)\right )}{2 f}\\ &=\frac{(a-b)^2 \log (\cos (e+f x))}{f}+\frac{a^2 \log (\tan (e+f x))}{f}+\frac{b^2 \tan ^2(e+f x)}{2 f}\\ \end{align*}

Mathematica [A]  time = 0.120248, size = 65, normalized size = 1.27 \[ \frac{a^2 (\log (\tan (e+f x))+\log (\cos (e+f x)))}{f}-\frac{2 a b \log (\cos (e+f x))}{f}+\frac{b^2 \left (\tan ^2(e+f x)+2 \log (\cos (e+f x))\right )}{2 f} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[e + f*x]*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

(-2*a*b*Log[Cos[e + f*x]])/f + (a^2*(Log[Cos[e + f*x]] + Log[Tan[e + f*x]]))/f + (b^2*(2*Log[Cos[e + f*x]] + T
an[e + f*x]^2))/(2*f)

________________________________________________________________________________________

Maple [A]  time = 0.052, size = 60, normalized size = 1.2 \begin{align*}{\frac{{b}^{2} \left ( \tan \left ( fx+e \right ) \right ) ^{2}}{2\,f}}+{\frac{{b}^{2}\ln \left ( \cos \left ( fx+e \right ) \right ) }{f}}-2\,{\frac{ab\ln \left ( \cos \left ( fx+e \right ) \right ) }{f}}+{\frac{{a}^{2}\ln \left ( \sin \left ( fx+e \right ) \right ) }{f}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(f*x+e)*(a+b*tan(f*x+e)^2)^2,x)

[Out]

1/2*b^2*tan(f*x+e)^2/f+1/f*b^2*ln(cos(f*x+e))-2/f*a*b*ln(cos(f*x+e))+1/f*a^2*ln(sin(f*x+e))

________________________________________________________________________________________

Maxima [A]  time = 1.08708, size = 80, normalized size = 1.57 \begin{align*} \frac{a^{2} \log \left (\sin \left (f x + e\right )^{2}\right ) -{\left (2 \, a b - b^{2}\right )} \log \left (\sin \left (f x + e\right )^{2} - 1\right ) - \frac{b^{2}}{\sin \left (f x + e\right )^{2} - 1}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

1/2*(a^2*log(sin(f*x + e)^2) - (2*a*b - b^2)*log(sin(f*x + e)^2 - 1) - b^2/(sin(f*x + e)^2 - 1))/f

________________________________________________________________________________________

Fricas [A]  time = 1.16974, size = 161, normalized size = 3.16 \begin{align*} \frac{b^{2} \tan \left (f x + e\right )^{2} + a^{2} \log \left (\frac{\tan \left (f x + e\right )^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) -{\left (2 \, a b - b^{2}\right )} \log \left (\frac{1}{\tan \left (f x + e\right )^{2} + 1}\right )}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

1/2*(b^2*tan(f*x + e)^2 + a^2*log(tan(f*x + e)^2/(tan(f*x + e)^2 + 1)) - (2*a*b - b^2)*log(1/(tan(f*x + e)^2 +
 1)))/f

________________________________________________________________________________________

Sympy [A]  time = 2.48656, size = 97, normalized size = 1.9 \begin{align*} \begin{cases} - \frac{a^{2} \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac{a^{2} \log{\left (\tan{\left (e + f x \right )} \right )}}{f} + \frac{a b \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - \frac{b^{2} \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac{b^{2} \tan ^{2}{\left (e + f x \right )}}{2 f} & \text{for}\: f \neq 0 \\x \left (a + b \tan ^{2}{\left (e \right )}\right )^{2} \cot{\left (e \right )} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)*(a+b*tan(f*x+e)**2)**2,x)

[Out]

Piecewise((-a**2*log(tan(e + f*x)**2 + 1)/(2*f) + a**2*log(tan(e + f*x))/f + a*b*log(tan(e + f*x)**2 + 1)/f -
b**2*log(tan(e + f*x)**2 + 1)/(2*f) + b**2*tan(e + f*x)**2/(2*f), Ne(f, 0)), (x*(a + b*tan(e)**2)**2*cot(e), T
rue))

________________________________________________________________________________________

Giac [A]  time = 1.57969, size = 124, normalized size = 2.43 \begin{align*} \frac{a^{2} \log \left (\sin \left (f x + e\right )^{2}\right ) -{\left (2 \, a b - b^{2}\right )} \log \left (-\sin \left (f x + e\right )^{2} + 1\right ) + \frac{2 \, a b \sin \left (f x + e\right )^{2} - b^{2} \sin \left (f x + e\right )^{2} - 2 \, a b}{\sin \left (f x + e\right )^{2} - 1}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

1/2*(a^2*log(sin(f*x + e)^2) - (2*a*b - b^2)*log(-sin(f*x + e)^2 + 1) + (2*a*b*sin(f*x + e)^2 - b^2*sin(f*x +
e)^2 - 2*a*b)/(sin(f*x + e)^2 - 1))/f